﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="CommonHealthModify.aspx.cs" Inherits="CommonHealthModify" %>







<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
 <div id="newtable" style="height:450px; width:350px;float:right; ">
             
              <div id="editb" style=" margin-top:10px;background-color:darkred;width:350px;height:20px;text-align:center"><label style="color:white">編輯</label>                  
                   </div>
     <asp:Table  ID="Table2" runat="server" Height="450px" Width="350px" BackColor="White" BorderColor="Maroon" BorderStyle="Double" Visible="True">
                  <asp:TableRow runat="server" Width="100px">
                      <asp:TableCell runat="server" Width="50px">
                          <asp:Label ID="Label5" runat="server" Text="分類"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server" Width="270px">
                          <asp:TextBox ID="TextBox4" style="margin:3px" runat="server"></asp:TextBox>
                        <div id="circle" >  <asp:Label ID="sindx"  ForeColor="White" runat="server" Text=""></asp:Label></div>
</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server"> <asp:Label ID="Label6" runat="server" Text="標題"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server">
                          <asp:TextBox ID="TextBox5" style="margin:3px" runat="server"></asp:TextBox>
</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server"> <asp:Label ID="Label7" runat="server" Text="內文"></asp:Label>
</asp:TableCell>
                      <asp:TableCell runat="server">
                          <asp:TextBox ID="TextBox6" style="margin:3px" runat="server" height="200px" width="200px" TextMode="MultiLine"></asp:TextBox> 

</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server">
                          <asp:Label ID="Label8" runat="server" Text="圖片"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server" >
                          <asp:FileUpload style="margin:3px" ID="FileUpload1" runat="server" />
                          <asp:Image style="margin:3px" ID="Image2" runat="server" Height="100" Width="100" />

</asp:TableCell>
                      
                      
                       </asp:TableRow>
                  <asp:TableRow>
                      <asp:TableCell ColumnSpan="2" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:Button runat="server" Text="更新"  OnClick="btnupdata_Click"  Width="150" ID="btnupdata" /><asp:Button runat="server" ForeColor="Red" Text="刪除"  OnClick="btndelete_Click" Width="150" ID="btndelete" OnClientClick="return confirm('確定要刪除這筆記錄嗎?')" />

                      </asp:TableCell>
                  </asp:TableRow>
              </asp:Table>




       
              
              
              
              
              
              
              
              
              
               <div id="newb" style=" margin-top:10px;background-color:darkred;width:350px;height:20px;text-align:center"><label style="color:white"> 新增</label>
   </div>
              <asp:Table  ID="Table1" runat="server" Height="450px" Width="350px" BackColor="White" BorderColor="Maroon" BorderStyle="Double" Visible="True">
                  <asp:TableRow runat="server" Width="100px">
                      <asp:TableCell runat="server" Width="50px">
                          <asp:Label ID="Label1" runat="server" Text="分類"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server" Width="270px">
                          <asp:TextBox ID="TextBox1" style="margin:3px" runat="server"></asp:TextBox>
</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server"> <asp:Label ID="Label2" runat="server" Text="標題"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server">
                          <asp:TextBox ID="TextBox2" style="margin:3px" runat="server"></asp:TextBox>
</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server"> <asp:Label ID="Label3" runat="server" Text="內文"></asp:Label>
</asp:TableCell>
                      <asp:TableCell runat="server">
                          <asp:TextBox ID="TextBox3" style="margin:3px" runat="server" height="200px" width="200px" TextMode="MultiLine"></asp:TextBox> 

</asp:TableCell>
                  </asp:TableRow>
                  <asp:TableRow runat="server">
                      <asp:TableCell runat="server">
                          <asp:Label ID="Label4" runat="server" Text="圖片"></asp:Label> 

</asp:TableCell>
                      <asp:TableCell runat="server" >
                          <asp:FileUpload style="margin:3px" ID="FileUpload3" runat="server" />
                          <asp:Image style="margin:3px" ID="Image1" runat="server" Height="100" Width="100" />

</asp:TableCell>
                      
                      
                       </asp:TableRow>
                  <asp:TableRow>
                      <asp:TableCell ColumnSpan="2" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:Button runat="server" Text="新增" OnClick="btnNew_Click" Width="250" ID="btnNew" />

                      </asp:TableCell>
                  </asp:TableRow>
              </asp:Table>
                  
               
              
          </div>
      <div style="width:960px;height:1080px;margin:0 auto">
       <div class="left" style="margin-top:100px" >
         <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Health_ID" DataSourceID="SqlDataSource1" Height="16px" Width="960px" OnRowCreated="GridView1_RowCreated"  OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand"  PageSize="8">
            <Columns>
                <asp:BoundField DataField="Health_ID" HeaderText="編號" InsertVisible="False" ReadOnly="True" SortExpression="Health_ID" >
                <HeaderStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Health_Type" HeaderText="分類" SortExpression="Health_Type" >
                <HeaderStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Health_Title" HeaderText="標題" SortExpression="Health_Title" >
                <HeaderStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="Health_Cont" HeaderText="內文" SortExpression="Health_Cont" >
                <ControlStyle Width="260px" />
                <HeaderStyle Width="260px" />
                <ItemStyle Width="260px" />
                </asp:BoundField>
                <asp:ImageField DataImageUrlField="Health_ID" DataImageUrlFormatString="~/Handlers/HealthPic.ashx?Health_ID={0}" HeaderText="圖片">
                    <ControlStyle Height="100px" Width="100px" />
                    <ItemStyle Height="100px" Width="100px" />
                </asp:ImageField>
                <asp:ButtonField Text="編輯" commandName="mys"   >
                <HeaderStyle Width="50px" />
                </asp:ButtonField>
            </Columns>
             <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
           
        </div>
    
          
 


              
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MedicareConnectionString %>" SelectCommand="SELECT * FROM [HealthKnowledge]"></asp:SqlDataSource>
          
 </div>

<script>

    $(function () {

        });


       $("#newb").mouseover(function () {

           $(this).css("background-color", "blue")



           $("#ContentPlaceHolder2_Table1").toggle(300);
       }).mouseout(function () {
           $(this).css("background-color", "darkred");
          
       });
    
       $("#editb").mouseover(function () {

           $(this).css("background-color", "blue");
           $("#ContentPlaceHolder2_Table2").toggle(300);
       }).mouseout(function () {
           $(this).css("background-color", "darkred");

       });

     



   

  

    $("#ContentPlaceHolder2_Table1 td").change(function () {
    var upf = $(this).children("input")[0];
    var img = $(this).children("img")[0];


        img.src =window.URL.createObjectURL(upf.files[0]);

    });
    
    $("#ContentPlaceHolder2_Table2 td").change(function () {
        var upf = $(this).children("input")[0];
        var img = $(this).children("img")[0];


        img.src = window.URL.createObjectURL(upf.files[0]);

    });

</script>



   

</asp:Content>

